<%-- 
    Document   : editCategory
    Created on : Jun 5, 2012, 2:22:16 PM
    Author     : Owner
--%>

<%@include file="/jsp/adminTop.jsp"%>
<html>
    <head>
        <title>Edit Category</title>
    </head>
    <body>
        <div class="clear"></div>
        <table border="1" cellspacing="10px" align="center" width="100%">
            <td style="vertical-align: top;" width="20%">
                <%@include file="/jsp/right.jsp" %>
            </td>
            <td>                &nbsp;            </td>
            <td style="vertical-align: top;" width="80%">
                <div class="page-title"><h1>Manage Categories</h1></div>
                <table border="1" cellspacing="10px" align="center">
                    <tr>
                        <td><h2>Edit Category</h2></td>
                        <td>[<a href="./category.do?action=showManageCategory">List Categories</a>|
                            <a href="./category.do?action=showAddCategory">Add Category</a> ]                            
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <html:form action="/category" method="post" enctype="multipart/form-data">
                                <logic:present name="category" scope="request">
                                    <table border="1" cellspacing="10px" align="center">
                                        <tr>
                                            <td colspan="2">Category Details</td>
                                        </tr>
                                        <tr>
                                            <td colspan="2">Category Id:<bean:write name="category" property="categoryId"/>
                                                <html:hidden name="category" property="categoryId"/></td>
                                        </tr>
                                        <tr>
                                            <td>Category Name:</td>
                                            <td><html:text name="category" property="categoryName"/></td>
                                        </tr>
                                        <tr>
                                            <td colspan="2"><html:errors property="errCategoryName"/></td>
                                        </tr>
                                        <tr>
                                            <td>Category Title:</td>
                                            <td><html:text name="category" property="categoryTitle"/></td>
                                        </tr>
                                        <tr>
                                            <td colspan="2"><html:errors property="errCategoryTitle"/></td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <logic:equal name="category" property="mainCategory" value="1" >
                                                    <div id="maincategory" style="display: block">
                                                        <input type="checkbox" name="category" checked="checked" value="1" onchange="javascript:togglediv('parentCategory');"/> Main Category
                                                        <html:hidden property="mainCategory" name="category" value="true"/>
                                                    </div>
                                                </logic:equal>
                                                <logic:equal name="category" property="mainCategory" value="0" >
                                                    <div id="maincategory" style="display: none">
                                                        <input type="checkbox" name="category" value="0" onchange="javascript:togglediv('parentCategory');"/> Main Category
                                                        <html:hidden property="mainCategory" name="category" value="false"/>
                                                    </div>
                                                </logic:equal>

                                            </td>
                                            <td>
                                                <logic:equal name="category" property="mainCategory" value="0" >
                                                    <div id="parentCategory" style="display: block">
                                                        Parent Category:<br/><html:select name="category" property="parentCategoryId" onchange="javascript:togglediv('maincategory');">
                                                            <html:option value="0">--Select--</html:option>
                                                            <html:options collection="parentCategList" property="key" labelProperty="value"/>
                                                        </html:select>
                                                            <html:hidden property="mainCategory" name="category" value="false"/>
                                                    </div>
                                                </logic:equal>
                                                <logic:equal name="category" property="mainCategory" value="1" >
                                                    <div id="parentCategory" style="display: none">
                                                        Parent Category:<br/><html:select name="category" property="parentCategoryId" onchange="javascript:togglediv('maincategory');">
                                                            <html:option value="0">--Select--</html:option>
                                                            <html:options collection="parentCategList" property="key" labelProperty="value"/>
                                                        </html:select>
                                                            <html:hidden property="mainCategory" name="category" value="true"/>
                                                    </div>
                                                </logic:equal>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="2"><html:errors property="errParentCategory"/></td>
                                        </tr>
                                        <tr>
                                            <td>Image:</td>
                                            <td><html:file name="category" property="categoryImage" accept="image/*" />
                                                <br/>
                                                <html:hidden name="category" property="categoryImageName" />
                                                <img src="category/<bean:write name="category" property="categoryImageName"/>" alt="Category Image"
                                                     style="width: 200px; height: 150px; border: 1px solid #ffffff; "/></td>
                                        </tr>
                                        <tr>
                                            <td colspan="2"><html:errors property="errCategoryImage"/></td>
                                        </tr>
                                        <tr>
                                            <td>Status:</td>
                                            <td><html:select name="category" property="categoryStatusId">
                                                    <html:option value="0">--Status--</html:option>
                                                    <html:options collection="statusList" property="key" labelProperty="value"/>
                                                </html:select>  </td>
                                        </tr>
                                        <tr>
                                            <td colspan="2"><html:errors property="errCategoryTitle"/></td>
                                        </tr>
                                        <tr>
                                            <td>Short Description:</td>
                                            <td><html:textarea name="category" property="categoryDesc"/></td>
                                        </tr>
                                        <tr>
                                            <td colspan="2"><html:errors property="errCategoryDescription"/></td>
                                        </tr>
                                        <tr>
                                            <td colspan="2">
                                                <div id="errdividcategory" >
                                                    <span id="errspanidcategory"></span>
                                                    <html:errors property="errCategory"/>
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td><a onclick="javascript:return validateCategory('./category.do?action=updateCategory','CategoryBean')">
                                                    <img src="images/update.png" onmouseout="src='images/update.png'" onmouseover="src='images/update-hover.png'" alt="Update Category" /></a></td>
                                            <td><a onclick="javascript:deleteCategory('./category.do?action=deleteCategory','CategoryBean')">
                                                    <img src="images/delete.png" onmouseout="src='images/delete.png'" onmouseover="src='images/delete-hover.png'" alt="Delete Category" /></a></td>
                                        </tr>

                                    </table>
                                </logic:present>
                            </html:form>
                        </td>
                    </tr>
                </table>
            </td>
        </table>

    </body>
</html>
